import con from "@/api/axios";
import zhreq from "@/api/axios";

export default {
  /**
   * @description:模板近期的农事任务
   * @param {Number}  batchNo
   * @param {Number}  organizationNo
   * @return {Object}
   */
  queryTemplate(params) {
    return con.post("v3/agriculturalTask/agriculturalTask/queryByCondition", params);
  },
  // 模型农事
  queryTagriculturalTask(params) {
    return con.post("v3/agriculturalTask/agriculturalTask/queryPageByCondition", params);
  },
  /**
   * @description: 根据批次id获取当前生长阶段id
   * @param {Number}  batchNo
   * @return {Object}
   */
  queryGrowthPhaseIdByBatchId(params) {
    return con.get(
      `/cumulative/cum/queryGrowthPhaseIdByBatchId/${params.batchNo}`
    );
  },
  /**
   * @description: 根据批次id获取生长阶段列表
   * @param {Number}  batchNo
   * @return {Object}
   */
  queryGrowthPhaseByBatchId(params) {
    return con.get(
      `v3/growth/growthSeedAnalysis/queryGrowthPhaseListByBatchNo?batchNo=${params.batchNo}`
    );
  },
  /**
  * @description: 根据批次id获取生长阶段列表
  * @param {Number}  batchNo
  * @return {Object}
  */
  queryGrowthCycle(params) {
    return con.get(
      `v3/growth/growthSeedAnalysis/queryGrowthCycleListByBatchNo?batchNo=${params.batchNo}`
    );
  }, /**
  * @description: 根据批次id获取生长阶段列表
  * @param {Number}  batchNo
  * @return {Object}
  */
  queryActualGrowDays(params) {
    return con.get(
      `v3/growth/growthSeedAnalysis/queryActualGrowDaysByBatchNo?batchNo=${params.batchNo}`
    );
  },
  /**
   * @description: 根据图片id获取图片数据
   * @param {Number}  pictureId
   * @return {Object}
   */
  queryPicture(params) {
    return con.get(`/cumulative/cum/queryPicture/${params.pictureId}`);
  },

  // /**
  //  * @description:根据批次id和生长阶段id查询生长阶段的图片id
  //  * @param {Number}  batchNo
  //  * @param {Number}  growthPhaseId
  //  * @return {Object}
  //  */
  queryPictureByGrowthPhaseId(params) {
    return con.get(`v3/growth/growthSeedAnalysis/queryCollectRecordByBatchNoAndPhaseNo?batchNo=${params.batchNo}&phaseNo=${params.phaseNo}`);
  },
  /**
   * @description:根据批次id查询生长阶段生长阶段id
   * @param {Number}  growthPhaseId
   * @return {Object}
   */
  querySeedAnalysis(params) {
    return con.get(`v3/growth/growthSeedAnalysis/queryGrowthPhaseNoByBatchNo?batchNo=${params}`);
  },
  /**
   * @description:根据生长阶段查询生长阶段数据
   * @param {Number}  growthPhaseId
   * @return {Object}
   */
  queryGrowthPhase(params) {
    return con.post(`v3/templateTenant/growthPhase/queryByCondition`, {
      ...params
    });
  },
  /**
  * @description:根据生长阶段查询当前生长图片
  * @param {Number}  growthPhaseId
  * @return {Object}
  */
  queryPhasePicture(params) {
    return con.get(`v3/templateTenant/phasePicture/queryByNo?no=${params}&organizationNo=${sessionStorage.organizationNo}`, {
      ...params
    });
  },
  /**
  * @description:根据生长图片No当前生长图片
  * @param {Number}  growthPhaseId
  * @return {Object}
  */
  queryGrowthPhasePicture(params) {
    return con.get(`v3/templateTenant/queryGrowthPhasePicture?pictureNo=${params}`);
  },
  /**
  * @description:根据采集图片编号获取采集图片
  * @param {Number}  growthPhaseId
  * @return {Object}
  */
  queryGrowtSeedAnalysisPicture(params) {
    return con.get(`v3/growth/growthSeedAnalysis/queryCollectPicture?pictureNo=${params}`);
  },

  querydefaultImage(params) {
    return con.post(`v3/config/defaultImage/queryByCondition`, params);
  },
  /**
   * @description:根据生长阶段id和批次id获取物联数据
   * @param {Number}  batchNo
   * @param {Number}  growthPhaseId
   * @return {Object}
   */
  queryDataGrowthPhaseId(params) {
    return con.post("/cumulative/cum/queryDataGrowthPhaseId", params);
  },
  // 获取物联数据id
  queryDataItem(params) {
    return con.post(`v3/iot/dataItem/queryByCondition`, params);
  },
  // 获取物联数据
  queryCollectNew(params) {
    return con.get(`v3/iot/dataCollectNew/queryListById?dataItemIdList=${params}`);
  },

  // c查询批次下的设施
  queryfindFacility(params) {
    return con.get(`v3/batch/productionBatch/findFacilityByBatchNo?no=${params}`);
  },
  /** *****************生长特征**************************/
  /**

  /**
   * @description:上传图片
   * @param {Number}  formdata
   * @return {Object}
   */
  uploadFiles(params) {
    return con.post("/picture/uploadFiles", params);
  },
  /**
   * @description:主键批量删除接口
   * @param {Array}  pictureIdList
   * @return {Object}
   */
  delList(params) {
    return con.post("/picture/delList", params);
  },

  /**
   * @description:查询图片
   * @param {Number}  pictureId
   * @return {Object}
   */
  queryByPicture(params) {
    return con.get("/picture/queryByIdList", params);
  },
  /** *****************生长特征**************************/
  /**
   * @description:根据阶段获取生长内容
   * @param {Number}  organizationNo
   * @param {Number}  growthPhaseId
   * @return {Object}
   */
  // 获取虫害
  queryGrowthContent(params) {
    return con.get(`v3/modelTenant/pest/queryByGrowthPhaseNo?growthPhaseNo=${params}&organizationNo=${sessionStorage.organizationNo}`);
  },
  pestImage(diseaseImageId) {
    return con.get(`v3/modelTenant/pestImage/query?diseaseImageId=${diseaseImageId}`, {
      diseaseImageId: diseaseImageId
    });
  },
  // 获取病害
  querydsContent(params) {
    return con.get(`v3/modelTenant/disease/queryByGrowthPhaseNo?organizationNo=${sessionStorage.organizationNo}&growthPhaseNo=${params}`);
  },
  diseaseImage(diseaseImageId) {
    return con.get(`v3/modelTenant/diseaseImage/query?diseaseImageId=${diseaseImageId}`, {
      diseaseImageId: diseaseImageId
    });
  },
  // 获取农事
  queryfeaturesContent(params) {
    return con.get(`v3/modelTenant/features/queryByGrowthPhaseNo?growthPhaseNo=${params}&organizationNo=${sessionStorage.organizationNo}`);
  },
  featuresImage(diseaseImageId) {
    return con.get(`v3/modelTenant/featuresImage/query?featuresImageId=${diseaseImageId}`, {
      diseaseImageId: diseaseImageId
    });
  },
  /**
   * @description:添加
   * @param {Number} growthPhaseId
   * @param {Array}  stageContectDTOList
   * @return {Object}
   */
  addGrowth(params) {
    return con.post("/stageFeature/add", params);
  },

  /**
   * @description:周期（根据种养类型查询）
   * @param {Number} plantingTypeId
   * @return {Object}
   */
  queryByCondition(params) {
    return zhreq.post("/growthPhase/queryByCondition", params);
  },
  /** ****************种养类型生长环境************************/
  /**
   * @description:根据批次查询
   * @param {Number} batchNoNo
   * @return {Object}
   */
  queryBybatchNoNo(params) {
    return con.get("/varietiesEnvironment/queryBybatchNoNo", params);
  },

  /**
   * @description:添加
   * @param {Number} organizationNo
   * @param {Number} plantingTypeId
   * @param {Number} plantingTypeName
   * @param {Array}  varietiesEnvironmentStageList
   * @return {Object}
   */
  addVarieties(params) {
    return con.post("/varietiesEnvironment/add", params);
  },
  /**
   * @description:删除
   * @param {Array}  varietiesEnvironmentIdList
   * @return {Object}
   */
  delVarietiesList(params) {
    return con.post("/varietiesEnvironment/delList", params);
  },
  /**
   * @description:修改
   * @param {Number} organizationNo
   * @param {Number} varietiesEnvironmentId
   * @param {Number} plantingTypeId
   * @param {Number} plantingTypeName
   * @param {Array}  varietiesEnvironmentStageList
   * @return {Object}
   */
  editVarieties(params) {
    return con.post("/varietiesEnvironment/edit", params);
  },

  /** *************************************气象数据******************************* */
  /**
   * @description: 查询数据项最新数据
   * @param {Array} dataItemIdList
   * @return {Object}
   */
  queryListById(params) {
    return zhreq.get(
      `/dataCollectNew/queryListById?dataItemIdList=${params.dataItemIdList}`
    );
  },
  /**
   * @description: 查询天气数据项
   * @param {Number} organizationNo
   * @param {String} "category":"weather"
   * @return {Object}
   */
  queryWeatherByCondition(params) {
    return zhreq.post("/sensorFacilityMapper/queryByCondition", params);
  },
  /** *****************生长阶段修改进度条                                           ***************************/
  /**
   * @description: 添加
   * @param {Number} growthPhaseId
   * @param {Date} endDate
   * @return {Object}
   */
  addBatchStage(params) {
    return con.post("v3/modelTenant/batchPhaseConfig/edit", params);
  }
  /**
   * @description: 根据批次查询生长周期
   * @param {String} batchNoNo
   * @return {Object}
   */
  // queryGrowthCycle(params) {
  //   return con.get("/batchStage/queryGrowthCycle", params);
  // }
  /**
   * @description: 根据生长阶段里面的图片id查图片数据
   * @param {Array} pictureId
   * @return {Object}
   */
  // queryGrowthPhasePicture(params) {
  //   return con.get(
  //     `cumulative/cum/queryGrowthPhasePicture/${params.pictureId}`
  //   );
  // }
};
